#ifndef __BOX_H__
#define __BOX_H__

#include <GL/glut.h>

#include "Drawable.h"
#include "CoordF.h"
#include "Plane.h"
#include "Line.h"

/*
 * Classe: Box
 *  Herda de: Drawable
 *
 *   Caixa texturizada composta de 6 Planes
 *
*/

class Box: public Drawable
{
      protected:
              Plane  side[6];
              Line   edge[12];
              CoordF vertex[8];
              
              CoordF res;
              GLfloat width, height, depth;
             
              virtual void setVertexes();
              virtual void setEdges();
              virtual void setSides();
              
              virtual void render();

      public:
             enum boxSides { FRONT, LEFT, BACK, RIGHT, TOP, BOTTOM };
             enum boxEdges { AB, BC, CD, DA, AE, BF, CG, DH, EF, FG, GH, HE };
             enum boxVertexes { A, B, C, D, E, F, G, H };
             
             Box ();
             Box ( CoordF pos, GLfloat w, GLfloat h, GLfloat d );
             Box ( CoordF pos, GLfloat w, GLfloat h, GLfloat d, CoordF c );
             Box ( CoordF pos, GLfloat w, GLfloat h, GLfloat d, int c );
             Box ( CoordF pos, GLfloat w, GLfloat h, GLfloat d, const char * tex );
             Box ( CoordF pos, GLfloat w, GLfloat h, GLfloat d, const char * texarray[6] );
             ~Box() {}
             
             virtual void setDimensions ( GLfloat w, GLfloat h, GLfloat d );
             GLfloat getWidth() { return width; }
             GLfloat getHeight() { return height; }
             GLfloat getDepth() { return depth; }
             
             CoordF getVertex(int i);
             Line   getEdge(int i);
             Plane  getSide(int i);
             
             virtual void setRes ( CoordF newRes );
             
             virtual void setTex ( const char * tex );
             virtual void setTex ( const char * texarray[6] );

             virtual void setColor ( CoordF c );
             virtual void setColor ( int c );
             
             virtual void toggleWireframe() { for (int i=0;i<6;i++) side[i].toggleWireframe(); }
             virtual void toggleLighting() { for (int i=0;i<6;i++) side[i].toggleLighting(); }
};

#endif
